// api.js
import request from '../request.js'; // 根据实际路径调整

// 定义默认参数（可选）
const DEFAULT_PARAMS = {
  channel: '44',
  filter: [],
  orderby: '',
  orderway: '',
  page: 1,
  offset: 10
};

// 获取文章列表API
const getArchives = (params = {}) => {
  return request.get('/addons/cms/api.archives/index', {
    params: {
      ...DEFAULT_PARAMS,
      ...params
    }
  });
};

// 添加刷题记录API
const addStrecord = (data = {}) => {
  return request.post('/qJitzHdMZy.php/shuati/record/add', {
    headers: {
      'X-Requested-With': 'XMLHttpRequest' // 添加 AJAX 标识
    },
    row: {
      ...data
    }
  });
};

export { getArchives, addStrecord };